Point (parameter type)

Point parameters, describing a position, are specified with type="Point" or type="Point3D" in the parameter definition:

    {name="MyPoint", type="Point", default=-1}
    {name="MyPoint3D", type="Point3D", default=-1}

Note

The default coordinates for type="Point" can not be given directly in the parameter definition, and should instead be specified as default=-1.

The actual default value should be set in the constructor extension method of the tool:

function _MyTool:constructor()
  if self.parameters.MyPoint == -1 then
    self.parameters.MyPoint = Point.create(10, 10)
  end
  if self.parameters.MyPoint3D == -1 then
    self.parameters.MyPoint3D = Point.create(10, 10, 10)
  end
end

A Point parameter is displayed with two edit fields (three for Point3D) for the coordinates in the panel for the tool, and a point editor in the image view:

../../../_images/ui-point-parameter.png

Edit fields for a Point

../../../_images/ui-viewer-point-editor.png

Editor for a Point in the image view

The current value of a Point and a Point3D parameter is accessed via self.parameters in execute, which provides a Point-crown instance:

  local myPoint = self.parameters.MyPoint
  local x = myPoint:getX()
  local y = myPoint:getY()
  local myPoint3D = self.parameters.MyPoint3D
  local x3D = myPoint3D:getX()
  local y3D = myPoint3D:getY()
  local z3D = myPoint3D:getZ()

See also